﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

namespace DONGTAIWANGYE
{
    public partial class _default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Label4.Text = "初始化时间：" + DateTime.Now.ToString();
            Timer1.Interval = 1000; 
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string strCn = "server=pc.hstc.cn;database=dhd2014112117;uid=2014112117;pwd=19960218";
            string strSQL = "select * from UserInfo where UserName='" + userName.Text + "'  AND  Password='" + userPass.Text + "'";
            SqlConnection conn = new SqlConnection(strCn);
            conn.Open();
            DataSet ds = new DataSet();
            SqlDataAdapter sql = new SqlDataAdapter(strSQL, conn);
            sql.Fill(ds);
            conn.Close();
            if (ds.Tables[0].Rows.Count > 0)
            {
                
                Response.Redirect("WebForm7.aspx");
            }
            else
            {
                Response.Write("<script>alert('用户名或密码错误')</script>");
            }
        }

        protected void Timer1_Tick(object sender, EventArgs e)
        {
            Label3.Text = "刷新时间：" + DateTime.Now.ToString(); 
        }


        protected void ButtonZ_Click(object sender, EventArgs e)
        {

        }
        }
    }
